//
//  DataBaseManager.h
//  UI23_FMDB
//
//  Created by dllo on 16/3/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GalBaseModel.h"

//FMDB 一种本地数据持久化的封装
//在传统数据库SQLite3基础上进行封装 可以按照Oc的语法形式进行使用
//FMDataBase 数据库对象
//FMResultSet 查询结果集
//FMDataBaseQueue 批量操作时使用的队列
//增删改->executeUpdate(更新)'执行更新'
//查   ->executeQuery(查询)'执行查询'

@interface DataBaseManager : NSObject
//单例(地址不变)
+(DataBaseManager *)shareInstance;

@property(nonatomic, strong)FMDatabase *db;/**< 数据库对象*/
@property(nonatomic, strong) NSString *filePath;/**< 数据库路径*/

///开启数据库
-(void)openDB;
///关闭数据库
-(void)closeDB;
//创建表
-(void)createTable;
-(void)createTableS;
///删除表
-(void)dropTable;
-(void)dropTablePhoto;
///增
-(void)insertData:(NSString *)title photo:(NSString *)coverPhoto;
-(void)insertGalBaseModel:(GalBaseModel *)m;
-(void)deleteBytitle:(NSString *)title;
-(void)deleteBymId:(NSNumber *)mId;
-(BOOL)selectCaseBytitle:(NSString *)title;
-(NSMutableArray *)selectAll;
-(NSMutableArray *)selectAllphotos;
-(BOOL)selectCaseBymId:(NSString *)mId;
@end
